﻿#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <assert.h>

char* my_strncpy(char* str1, const char* str2, int n)
{
	assert(str1 && str2);
	char* ret = str1;
	for (int i = 0; i < n; i++)
	{
		if (*str2)
		{
			*str1++ = *str2++;
		}
		else
		{
			*str1++ = *str2;
		}

	}
	return ret;
}

int main()
{
	char arr1[] = "abcdef";
	char arr2[] = "xxxxxxxxxxxx";
	my_strncpy(arr2, arr1, 7);
	printf("%s", arr2);
	return 0;
}